Updated code

Got rid of a lot of redundant code