Cleaned and simplified some stuff