updated almost completely working application