AmazonRDS code refactoring