Working version with UI