Tidying up unused arguments and includes.
Fix buffer overflow bug where wrptr == rdptr when full.