cleaned code got rid of redundancy