style and performance fixes following the @juanjux guidelines