First working version. Code smell.