MD & WV Residency Question

Last year I was living and working in West Virginia. In October I moved to Maryland but still work in West Virginia. 

 

1) I assume I need to file a state return for both states. 

2) On the West Virginia state return it asks for part year resident allocations. It shows my West Virginia Resident Income and asks how much "West Virginia Income While Nonresident". I have to assume this would be equal to the amount of State wages and tips earned while living in Maryland for the remainder of the year. 

 

My question is if both of the above are correct (have to file both returns and also pay West Virginia for taxes while not living there). Why would I need to pay West Virginia tax and also pay Maryland tax for that period of time from October until now.