fixing sergei's retardation
minor bugfixes throughout
style