added karma tests and move things into modules