Added clener code (not completely clean yet)