filling a* functions