Bug fixes + general improvements