moving main out, allows for linking as a library