updated formatting and fixed minor bugs