Compress imperative part of code