Code functions required to implement Neural Networks