Whitespace and other bugs fixed