Removed some code redundancy