adding proper handling of callbacks and UI