Deleted unused functions, cleaned up a bit