cleaned up and implementation of proper data emitting