An attempt to cleaner code

Work in progress