Removed redundant code
Complete overhaul