Not finished yet but code seems cleaner.