Fixed a number of issues, fixed style etc.