Better abstraction and command line arguments added