Refactored main a little bit. It's now easier to run without installing