Clean

Clean source code & improve logic