Improved type handling across the board, resolves #5