adding elasticache support, refactory