Add more cube functions

Fix silly mistakes, code cleanup