Optimeow and bugfix

See commits for descriptions