Remove unneeded variable.
Safety checks before executing commands.
Pass buffer length as argument.
Add application length and update count to config.