Fixing some methods to use better types, extracting method.