added pad method
added decode method
Working Solution: added working logic