moving logic functions to own stdlib file