Replaced alot of redunant code