added compile time, application states and some error handlings