Fixed bug with storing empty data and cleaned up