Fixed a const issue and removed some extra code