improved handling of bottom

not ready for review yet
same as above