Major Changes. Debugging needed.