Fixed minor bugs and formatting