removed some code redundancies