added getUsedBytes method and added debug statements for testing