Fixing errors, cleaning up