Should be working now MINUS some edge cases.