Before Theano implementation: works well with out theano