fixes #3, #4 and #5

Fixed memory leak that caused failiure. (#3)
Added conditions to check if interface is up or down. (#4)
Added command line options. (#5)