Cleaning up loading functionality