rebased to master for latest updates