Got second function working