Cleaned and scalable code