Refactor + error messages clearer + code cleaning