add tests and implement time limitations