Added comments + tests.R