restructured Application, reimplemented some of the functions