Complete app rewritten