Fix additional bugs + some cleanup