Fixed various bugs, and added the floor argument to various functions.