bugfix using invalid variable remain instead of remain_y
minor refactoring
added test_duplicate_details, disabled for now since this case is not implemented yet
report back remained amounts