refined helper functions, started to work on modeling part