fix and address most of @coderanger comments