Removed misplaced code
Minor optimizations