add existing code and testing