added attribute warn unused result where appropriate, found and fixed some bugs through that