Updated with all features
Clear buffer on new input, copy key to RAM only once