Working perfectly for command line

Will want to polish it a bit, but perfectly workable otherwise.