Cleaned up and commented most things