Removed dead code
Added error processing on wrong partition