Refactored according to discussion with Michalis and Matthias.