Refactored key code to a new file and added some UTs.
Adding/fixing UTs.
using argparse

fixes #1