some cleanup and features added