improvements on app states lib