Completed bug fixes + formatting