Issue 98 and code clean up