Working version. Cleaner as well.