Directory creation & overall style

Directory tree is created without nested loops. Most of procedural
structures rewritten, hopefully in an equivalent way. Added sections and
subsections to improve readability in FrontEnd.