huge cleanup of cube direction logic