Moved main function to Library

Here we gooooooooo