Adding some support and fixing some bugs