cleanup and refacotr gems