Typing: Changed all return values to int for consistency and the -1 error.