Fixed some spacing and function placement