fixed all bugs, ready for submission