Cleaned up decoding stuff