added usage support and did some minor cleanup