Updated: a lot; now this need to be refactored