Fixed and added various funcitonal tests