#2 First class prototype

probably this method is too long, would be cool to refactor