Added decode function. Refactored some and updated README