Cleaned up some funtions and deleted some redundant and non-scalable code