fixed code architecture and style re: #23