WIP: Optimizing the code