works until 9999, not refactoring still