added original code; added code to be refactured