adding node code and fixing some errors