Cleanup and added proper response to invaid input
Merge origin/master