Fixed references and got remaining functionality working