null checks and typos galore