Remove unnecessary include
Move variable declaration to proper section
Improve and add move error checking