Fixed issues when receiving ack frames, cleaned up code and comments