Fixed error when position at end on feature

Removed unnecessary imports, cleaned up code a little.