Massive code improvement, more configurable