Made more functional, fixed typo and misc minor adjustments