Moved to a more compact version of the code